<?php
function hashstring($string)
{
   //echo 'hash start';
   $majorsalt = '';
   //print($string);
   $pass = str_split1($string, 1);

   foreach ($pass as $hashpass)
   {
      $majorsalt .= md5($hashpass);
   }

   $corehash = md5($majorsalt);

   //print 'hash '.$corehash;
   //echo 'hash end';
   return $corehash;
}

function str_split1($string, $length) 
{
    //$length = 1;
   //echo 'split start';
        if ($length <= 0) {
            trigger_error(__FUNCTION__."(): The the length of each segment must be greater then zero:", E_USER_WARNING);
            return false;
        }
        $splitted  = array();
        $str_length = strlen($string);
        $i = 0;
        if ($length == 1) {
            while ($str_length--) {
                $splitted[$i] = $string[$i++];
            }
        } else {
            $j = $i;
            while ($str_length > 0) {
                $splitted[$j++] = substr($string, $i, $length);
                $str_length -= $length;
                $i += $length;
            }
        }
   //echo 'split end';
        return $splitted;
}
?>
